package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dto.WmUserDTO;
import com.heima.model.wemedia.pojos.WmUser;
import com.heima.wemedia.service.WemediaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.InvocationTargetException;

@RestController
@RequestMapping("/login")
@Api(value = "自媒体controller",tags = "自媒体controller")
public class LoginController {
    @Autowired
    private WemediaService wemediaService;

    @ApiOperation("根据用户名密码登录")
    @PostMapping("/in")
    public ResponseResult save(@RequestBody WmUserDTO wmUserDTO) throws InvocationTargetException, IllegalAccessException {
        return wemediaService.loginIn(wmUserDTO);
    }
}
